package com.ia2011.project1.aima;

import aima.search.framework.HeuristicFunction;

import com.ia2011.project1.debug.Debug;
import com.ia2011.project1.service.CarpoolingService;
import com.ia2011.project1.strategy.Heuristic;

public class CSHeuristicFunction extends Debug implements HeuristicFunction {

	private int type;
	
	public CSHeuristicFunction(int type) {
		super();
		this.type = type;
	}
	
	public int getHeuristicValue(Object obj) {
		CarpoolingService cs = (CarpoolingService) obj;
		if (type == 1) {
			Integer heuristic = (int) Math.ceil(Heuristic.H1(cs));
//			info("H1="+heuristic);
			return heuristic;
		} else if (type == 2) {
			Integer heuristic = (int) Math.ceil(Heuristic.H2(cs));
//			info("H2="+heuristic);
			return heuristic;
		} else {
			return 0;
		}
	}

}
